cmake_minimum_required(VERSION 2.8)
project(AbandonObjectDetect)

add_compile_options(-std=c++11)
add_compile_options(-pthread)
option(use_dlib "use dlib" ON)
option(use_ros "use ros"  OFF)
option(test_aod  "test" OFF)

if(use_dlib)
ADD_DEFINITIONS(-DDLIB)    
endif()

if(use_ros)
ADD_DEFINITIONS(-DROS)    
endif()


find_package(OpenCV REQUIRED)

file(GLOB_RECURSE SOURCE_FILES src/*.cpp)
file(GLOB_RECURSE TEST_FILES test/*.cpp)
file(GLOB_RECURSE HEADER_FILES include/*.h)

include_directories(
    ${CMAKE_CURRENT_LIST_DIR}/../${PROJECT_NAME}/include/AbandonObjectDetect    
    ${OpenCV_INCLUDE_DIRS}
)

add_library(${PROJECT_NAME}
  ${SOURCE_FILES}
  ${HEADER_FILES}
)

if(use_dlib)        
target_link_libraries(${PROJECT_NAME}
    ${OpenCV_LIBRARIES}        
    dlib
)
else()
target_link_libraries(${PROJECT_NAME}
    ${OpenCV_LIBRARIES}    
)
endif()


if(test_aod)
    add_executable(${PROJECT_NAME}_test
    ${TEST_FILES}
    )
    target_link_libraries(${PROJECT_NAME}_test
    ${PROJECT_NAME}
    pthread
    
    )

    install(TARGETS ${PROJECT_NAME}_test
        DESTINATION lib
        )
endif()

install(TARGETS ${PROJECT_NAME} 
        DESTINATION lib
        )
install(DIRECTORY include/
        DESTINATION include)